home *** CD-ROM | disk | FTP | other *** search
-
- ///////////////////////////////////////////////////////////////////////////////
- // Copyright 1995 by Potomac Software, Inc. Use of this material is subject to
- // the terms and conditions of the software license agreement.
-
- #ifndef __WEBLIBBC_H__
- #define __WEBLIBBC_H__
-
- #ifndef WEBLIB_NO_OWL
- #include <owl/window.h>
- #endif
- #include "weblib.h"
- #include "dispatbc.h"
-
- ///////////////////////////////////////////////////////////////////////////////
- // Browser classes.
- //
- // The TWeblibBrowserAPI class is a simple C++ wrapper around the API.
-
- class TWeblibBrowserAPI
- {
- public:
- TWeblibBrowserAPI();
- TWeblibBrowserAPI(WORD wOptions);
- virtual ~TWeblibBrowserAPI();
-
- BOOL IsGood() const;
-
- BOOL ConnectBrowser(WORD wOptions = WL_POSTMESSAGE | WL_STARTBROWSER);
- BOOL DisconnectBrowser(BOOL bExit = TRUE);
-
- BOOL GetWindowInfo(DWORD dwWindow,LPSTR lpszURL,int cbURL,LPSTR lpszTitle,int cbTitle) const;
- DWORD ListWindows(BOOL bFirst) const;
-
- DWORD ActivateWindow(DWORD dwWindow) const;
- BOOL CloseWindow(DWORD dwWindow) const;
-
- BOOL SetWindowPos(DWORD dwWindow,DWORD dwX,DWORD dwY,DWORD dwWidth,DWORD dwHeight) const;
- BOOL ShowWindow(DWORD dwWindow,UINT nShow) const;
-
- virtual DWORD ShowFile(LPCSTR lpszFile,LPCSTR lpszMIMEType,DWORD dwWindow,LPCSTR lpszURL,
- HWND hwndNotify,UINT nMsg) const;
-
- virtual DWORD OpenURL(LPCSTR lpszURL,DWORD dwWindow,WORD wOptions,
- HWND hwndNotify,UINT nMsg) const;
- virtual DWORD SaveURL(LPCSTR lpszURL,LPCSTR lpszFile,DWORD dwWindow,WORD wOptions,
- HWND hwndNotify,UINT nMsg) const;
-
- virtual DWORD PostFormData(LPCSTR lpszURL,DWORD dwWindow,LPCSTR lpszFormData,LPCSTR lpszMIMEType,
- HWND hwndNotify,UINT nMsg) const;
- virtual DWORD SaveFormData(LPCSTR lpszURL,LPCSTR lpszFile,DWORD dwWindow,LPCSTR lpszFormData,
- LPCSTR lpszMIMEType,HWND hwndNotify,UINT nMsg) const;
-
- BOOL Cancel(DWORD dwTransaction) const;
-
- virtual BOOL RegisterProtocol(LPCSTR lpszProtocol,HWND hwndNotify,UINT nMsg) const;
- virtual BOOL UnregisterProtocol(LPCSTR lpszProtocol,HWND hwndNotify) const;
-
- virtual BOOL RegisterURLEcho(HWND hwndNotify,UINT nMsg) const;
- virtual BOOL UnregisterURLEcho(HWND hwndNotify) const;
-
- virtual BOOL RegisterViewer(LPCSTR lpszMIMEType,WORD wOptions,HWND hwndNotify,UINT nMsg) const;
- virtual BOOL UnregisterViewer(LPCSTR lpszMIMEType,HWND hwndNotify) const;
-
- virtual BOOL RegisterWindowChange(DWORD dwWindow,HWND hwndNotify,UINT nMsg) const;
- virtual BOOL UnregisterWindowChange(DWORD dwWindow,HWND hwndNotify) const;
-
- LPCSTR ParseAnchor(LPCSTR lpszAbsoluteURL,LPCSTR lpszRelativeURL) const;
- DWORD GetVersion(WORD wMajor,WORD wMinor) const;
-
- LPCSTR QueryURLFile(LPCSTR lpszFile) const; // Netscape only!
-
- BOOL SetNotifyMethod(WORD wMethod) const;
- DWORD GetTransactionWindow(DWORD dwTransaction) const;
-
- protected:
- HBROWSER GetBrowserHandle() const
- { return m_hBrowser; }
-
- private:
- HBROWSER m_hBrowser;
- };
-
- ///////////////////////////////////////////////////////////////////////////////
- // If just want to use the above TWeblibBrowserAPI base class w/o OWL, then define
- // WEBLIB_NO_OWL in your project (for non-Borland C++ compilers and class libraries).
-
- #ifndef WEBLIB_NO_OWL
-
- ///////////////////////////////////////////////////////////////////////////////
- // The TWeblibBrowser derived class handles browser event notification automatically,
- // invoking the proper virtual event handler method when an event is received. To use,
- // derive your own class from TWeblibBrowser and override the notification handlers.
-
- class TWeblibBrowser : public TWeblibBrowserAPI, public TWeblibDispatch
- {
- public:
- TWeblibBrowser();
- TWeblibBrowser(WORD wOptions);
- virtual ~TWeblibBrowser();
-
- BOOL IsGood() const;
-
- ///////////////////////////////////////////////////////////////////////////
- // New public methods intended to supplant all base class methods that take
- // a notification window and message (notifications are sent to internal window).
-
- DWORD ShowFile(LPCSTR lpszFile,LPCSTR lpszMIMEType,DWORD dwWindow,LPCSTR lpszURL,
- BOOL bNotify = TRUE) const;
-
- DWORD OpenURL(LPCSTR lpszURL,DWORD dwWindow,WORD wOptions,
- BOOL bNotify = TRUE) const;
- DWORD SaveURL(LPCSTR lpszURL,LPCSTR lpszFile,DWORD dwWindow,WORD wOptions,
- BOOL bNotify = TRUE) const;
-
- DWORD PostFormData(LPCSTR lpszURL,DWORD dwWindow,LPCSTR lpszFormData,
- LPCSTR lpszMIMEType,BOOL bNotify = TRUE) const;
- DWORD SaveFormData(LPCSTR lpszURL,LPCSTR lpszFile,DWORD dwWindow,LPCSTR lpszFormData,
- LPCSTR lpszMIMEType,BOOL bNotify = TRUE) const;
-
- BOOL RegisterProtocol(LPCSTR lpszProtocol) const;
- BOOL UnregisterProtocol(LPCSTR lpszProtocol) const;
-
- BOOL RegisterURLEcho() const;
- BOOL UnregisterURLEcho() const;
-
- BOOL RegisterViewer(LPCSTR lpszMIMEType,WORD wOptions) const;
- BOOL UnregisterViewer(LPCSTR lpszMIMEType) const;
-
- BOOL RegisterWindowChange(DWORD dwWindow) const;
- BOOL UnregisterWindowChange(DWORD dwWindow) const;
-
- ///////////////////////////////////////////////////////////////////////////
- // Notification event handlers (override in your TWeblibBrowser-derived class).
-
- virtual void OnBeginProgress(DWORD dwTransaction,LPCSTR lpszProgress);
- virtual void OnSetProgressRange(DWORD dwTransaction,DWORD dwMaximum);
- virtual void OnMakingProgress(DWORD dwTransaction,DWORD dwProgress,LPCSTR lpszProgress);
- virtual void OnEndProgress(DWORD dwTransaction);
-
- virtual void OnFinished(DWORD dwTransaction,DWORD dwWindow);
- virtual void OnCanceled(DWORD dwTransaction);
-
- virtual void OnURLEcho(DWORD dwWindow,LPCSTR lpszURL,LPCSTR lpszMIME,LPCSTR lpszReferrer);
-
- virtual void OnOpenURL(DWORD dwTransaction,DWORD dwWindow,DWORD dwFlags,
- LPCSTR lpszURL,LPCSTR lpszMIME,LPCSTR lpszSaveFile,LPCSTR lpszFormData);
-
- virtual void OnWindowChange(DWORD dwWindow,DWORD dwFlags,DWORD dwX,DWORD dwY,
- DWORD dwWidth,DWORD dwHeight);
-
- virtual void OnQueryViewer(LPCSTR lpszURL,LPCSTR lpszMIME,LPSTR lpszFile,UINT cbFile);
-
- virtual void OnViewDocFile(DWORD dwWindow,LPCSTR lpszURL,LPCSTR lpszMIME,LPCSTR lpszFile);
-
- ///////////////////////////////////////////////////////////////////////////
- // Internal window passes notification messages to Dispatch() method.
-
- virtual LRESULT Dispatch(UINT nMsg,WPARAM wParam,LPARAM lParam);
-
- private:
-
- ///////////////////////////////////////////////////////////////////////////
- // Override public base class methods that take a notification window as
- // private (i.e., unavailable) since notifications are now sent to m_pWnd.
-
- virtual DWORD ShowFile(LPCSTR lpszFile,LPCSTR lpszMIMEType,DWORD dwWindow,LPCSTR lpszURL,
- HWND hwndNotify,UINT nMsg) const;
-
- virtual DWORD OpenURL(LPCSTR lpszURL,DWORD dwWindow,WORD wOptions,
- HWND hwndNotify,UINT nMsg) const;
- virtual DWORD SaveURL(LPCSTR lpszURL,LPCSTR lpszFile,DWORD dwWindow,WORD wOptions,
- HWND hwndNotify,UINT nMsg) const;
-
- virtual DWORD PostFormData(LPCSTR lpszURL,DWORD dwWindow,LPCSTR lpszFormData,LPCSTR lpszMIMEType,
- HWND hwndNotify,UINT nMsg) const;
- virtual DWORD SaveFormData(LPCSTR lpszURL,LPCSTR lpszFile,DWORD dwWindow,LPCSTR lpszFormData,
- LPCSTR lpszMIMEType,HWND hwndNotify,UINT nMsg) const;
-
- virtual BOOL RegisterProtocol(LPCSTR lpszProtocol,HWND hwndNotify,UINT nMsg) const;
- virtual BOOL UnregisterProtocol(LPCSTR lpszProtocol,HWND hwndNotify) const;
-
- virtual BOOL RegisterURLEcho(HWND hwndNotify,UINT nMsg) const;
- virtual BOOL UnregisterURLEcho(HWND hwndNotify) const;
-
- virtual BOOL RegisterViewer(LPCSTR lpszMIMEType,WORD wOptions,HWND hwndNotify,UINT nMsg) const;
- virtual BOOL UnregisterViewer(LPCSTR lpszMIMEType,HWND hwndNotify) const;
-
- virtual BOOL RegisterWindowChange(DWORD dwWindow,HWND hwndNotify,UINT nMsg) const;
- virtual BOOL UnregisterWindowChange(DWORD dwWindow,HWND hwndNotify) const;
-
- TWindow *m_pWindow;
- };
-
- #endif // WEBLIB_NO_OWL
-
- ///////////////////////////////////////////////////////////////////////////////
- // Toolbar classes.
- //
- // The TWeblibToolbarAPI class is a simple C++ wrapper around the API.
-
- class TWeblibToolbarAPI
- {
- public:
- TWeblibToolbarAPI();
- TWeblibToolbarAPI(LPCSTR lpszMenu,HWND hwndNotify,UINT nMsg);
- virtual ~TWeblibToolbarAPI();
-
- BOOL IsGood() const;
-
- virtual BOOL CreateToolbar(LPCSTR lpszMenu,HWND hwndNotify,UINT nMsg);
- BOOL DeleteToolbar();
-
- BOOL IsToolbarActive() const;
- BOOL SetActiveToolbar() const;
-
- BOOL AddToolbarButton(UINT nID,int nIdx,LPCSTR lpszText,HINSTANCE hInstance,
- LPCSTR lpszBitmap,LPCSTR lpszBitmapSel,LPCSTR lpszBitmapFocus,
- LPCSTR lpszBitmapDisabled) const;
- BOOL RemoveToolbarButton(UINT nID) const;
-
- BOOL IsToolbarButtonVisible(UINT nID) const;
- BOOL ShowToolbarButton(UINT nID,BOOL bShow) const;
-
- BOOL EnableToolbarButton(UINT nID,BOOL bEnable) const;
- BOOL IsToolbarButtonEnabled(UINT nID) const;
-
- LPCSTR GetToolbarText(UINT nID) const;
- BOOL SetToolbarText(UINT nID,LPCSTR lpszText) const;
-
- HFONT GetToolbarFont(WORD wType) const;
- BOOL SetToolbarFont(WORD wType,HFONT hFont) const;
-
- COLORREF GetToolbarBkgnd() const;
- BOOL SetToolbarBkgnd(COLORREF crBackground) const;
-
- COLORREF GetToolbarTextColor(WORD wType) const;
- BOOL SetToolbarTextColor(WORD wType,COLORREF crText) const;
-
- protected:
- HTOOLBAR GetToolbarHandle() const
- { return m_hToolbar; }
-
- private:
- HTOOLBAR m_hToolbar;
- };
-
- ///////////////////////////////////////////////////////////////////////////////
- // If just want to use the above TWeblibToolbarAPI base class w/o OWL, then define
- // WEBLIB_NO_OWL in your project (for non-Borland C++ compilers and class libraries).
-
- #ifndef WEBLIB_NO_OWL
-
- ///////////////////////////////////////////////////////////////////////////////
- // The TWeblibToolbar derived class handles button click notification via a
- // virtual event handler method. To use, derive your own class from TWeblibToolbarAPI
- // and override the button click notification handler.
-
- class TWeblibToolbar : public TWeblibToolbarAPI, public TWeblibDispatch
- {
- public:
- TWeblibToolbar();
- TWeblibToolbar(LPCSTR lpszMenu);
- virtual ~TWeblibToolbar();
-
- BOOL IsGood() const;
-
- ///////////////////////////////////////////////////////////////////////////
- // New public methods intended to supplant all base class methods that take
- // a notification window and message (notifications are now sent to m_pWnd).
-
- BOOL CreateToolbar(LPCSTR lpszMenu);
-
- ///////////////////////////////////////////////////////////////////////////
- // Notification event handlers (override in your TWeblibToolbar-derived class).
-
- virtual void OnButtonClicked(UINT nButtonID);
-
- ///////////////////////////////////////////////////////////////////////////
- // Internal window passes notification messages to Dispatch() method.
-
- virtual LRESULT Dispatch(UINT nMsg,WPARAM wParam,LPARAM lParam);
-
- private:
-
- ///////////////////////////////////////////////////////////////////////////
- // Override public base class methods that take a notification window as
- // private (i.e., unavailable) since notifications are sent to internal window.
-
- virtual BOOL CreateToolbar(LPCSTR lpszMenu,HWND hwndNotify,UINT nMsg);
-
- TWindow *m_pWindow;
- };
-
- #endif // WEBLIB_NO_OWL
-
- #include "weblibbc.inl"
-
- #endif // __WEBLIBVC_H__
-